import App from './App'
import uvUI from '@/uni_modules/uv-ui-tools'
import {
	Request
} from '@/utils/request.js'

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
Vue.use(uvUI);
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
Request(app)
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import * as Pinia from 'pinia';
const back = (delta = 1) => {
	var pages = getCurrentPages();
	var prevPage = pages[pages.length - 2];
	if (prevPage) {
		uni.navigateBack({
			delta
		})
	} else {
		uni.switchTab({
			url: '/pages/tabbar/home/index'
		})
	}
}
export function createApp() {
	const app = createSSRApp(App)
	app.use(uvUI);
	app.use(Pinia.createPinia());
	Request(app)
	app.provide('$back', back)
	return {
		app,
		Pinia,
	}
}
// #endif